package propertiesdemos;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Map;
import java.util.Properties;


public class PropetiesDemo {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		 Properties prop = new Properties();
		 prop.put("A","AAA");
		 prop.put("B","BBB");
		 prop.put("C", "CCC");
		 //iterate Properties
		 for(Map.Entry<Object,Object> mapEntry : prop.entrySet() ){
		 System.out.println(mapEntry.getKey() +" "+mapEntry.getValue());
		 }
		 //get value by key
		 System.out.println(prop.get("A"));
		 //export file in XML
		 FileOutputStream fos = new FileOutputStream(new File("C:/propFile.xml"));
		 prop.storeToXML(fos, "Properties exported.");
		 System.out.println("Done");

	}

}
